package day13.tarena.homework;

public class MyStack1 {
	private int id;
	private String name;
	
	public MyStack1(){
		super();
	}
	
	public MyStack1(int id, String name){
		super();
		this.setId(id);
		this.setName(name);
	}
	
	public int getId(){
		return id;
	}
	
	public void setId(int id){
		this.id=id;
	}
	
	public String getName(){
		return name;
	}
	
	public void setName(String name){
		this.name=name;
	}
	
	@Override
	public boolean equals(Object obj){
		if(obj == null){
			return false;
		}
		if(this.getClass() == obj.getClass()){
			MyStack1 m =  (MyStack1)obj;
			return m.id == this.id;
		}
			return false;
	}
	
	@Override
	public int hashCode(){
		int type = this.getClass().hashCode();
		return type*31 + id;
	}
	
	@Override
	public String toString(){
		return id+":"+ name;
	}
}
